import type { LabelValueState } from '@/types/global';
import http from '@/utils/http';
import type { TreeNodeData } from '@arco-design/web-vue';

const BASE_URL = '/common/asset'

export interface ProducerModelResp {
  id: string,
  name: string,
  status: string
}

export interface DepreacitionRulesResp {
  id: string,
  name: string,
  status: string
}

/** @desc 查询厂商列表 */
export function listProducer(query: { name: string | unknown }) {
  return http.get<ProducerModelResp[]>(`${BASE_URL}/producer`,query)
}

/** @desc 查询折旧规则列表 */
export function listDepreacitionRules(query: { name: string | unknown }) {
  return http.get<DepreacitionRulesResp[]>(`${BASE_URL}/list/depreciation/rules`, query)
}

/** @desc 查询软件类型树 */
export function listSoftwareCategoryTree(query: { description: string | unknown }) {
  return http.get<TreeNodeData[]>(`${BASE_URL}/tree/softwareCategory`, query)
}

/** @desc 查询配件类型树 */
export function listPartCategoryTree(query: { description: string | unknown }) {
  return http.get<TreeNodeData[]>(`${BASE_URL}/tree/partCategory`, query)
}

/** @desc 查询耗材类型树 */
export function listConsumableCategoryTree(query: { description: string | unknown }) {
  return http.get<TreeNodeData[]>(`${BASE_URL}/tree/consumableCategory`, query)
}

/** @desc 查询耗材列表 */
export function listConsumable(query?: { name: string, status: number }) {
  return http.get<LabelValueState[]>(`${BASE_URL}/list/consumable`, query)
}

/** @desc 查询设备类型树 */
export function listDeviceCategoryTree(query: { description: string | unknown }) {
  return http.get<TreeNodeData[]>(`${BASE_URL}/tree/device/category`, query)
}

/** @desc 查询设备品牌列表 */
export function listDeviceBrand(query: { categoryId: string | unknown }) {
  return http.get<string[]>(`${BASE_URL}/list/device/brand`, query)
}

/** @desc 查询设备型号列表 */
export function listDeviceModel(query: { categoryId: string | unknown }) {
  return http.get<string[]>(`${BASE_URL}/list/device/model`, query)
}
